home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / PInterfaces / PCCardTuples.p < prev    next >
Encoding:
Text File  |  1998-02-12  |  13.8 KB  |  481 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        PCCardTuples.p
  3.  
  4.      Contains:    List of PCMCIA tuple types and definitions of tuple contents.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.1
  8.  
  9.      Copyright:    © 1994-1998 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT PCCardTuples;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __PCCARDTUPLES__}
  28. {$SETC __PCCARDTUPLES__ := 1}
  29.  
  30. {$I+}
  31. {$SETC PCCardTuplesIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __MACTYPES__}
  35. {$I MacTypes.p}
  36. {$ENDC}
  37.  
  38.  
  39. {$PUSH}
  40. {$ALIGN MAC68K}
  41. {$LibExport+}
  42.  
  43.  
  44. CONST
  45.     MAX_TUPLE_SIZE                = 256;
  46.  
  47. {————————————————————————————————————————————————————————————————————————
  48.     Defines for Tuple codes
  49. ————————————————————————————————————————————————————————————————————————}
  50.     CISTPL_NULL                    = $00;
  51.     CISTPL_DEVICE                = $01;
  52.     CISTPL_LONGLINK_CB            = $02;
  53.     CISTPL_INDIRECT                = $03;
  54.     CISTPL_CONFIG_CB            = $04;
  55.     CISTPL_CFTABLE_ENTRY_CB        = $05;
  56.     CISTPL_LONGLINK_MFC            = $06;
  57.     CISTPL_BAR                    = $07;
  58.     CISTPL_CHECKSUM                = $10;
  59.     CISTPL_LONGLINK_A            = $11;
  60.     CISTPL_LONGLINK_C            = $12;
  61.     CISTPL_LINKTARGET            = $13;
  62.     CISTPL_NO_LINK                = $14;
  63.     CISTPL_VERS_1                = $15;
  64.     CISTPL_ALTSTR                = $16;
  65.     CISTPL_DEVICE_A                = $17;
  66.     CISTPL_JEDEC_C                = $18;
  67.     CISTPL_JEDEC_A                = $19;
  68.     CISTPL_CONFIG                = $1A;
  69.     CISTPL_CFTABLE_ENTRY        = $1B;
  70.     CISTPL_DEVICE_OC            = $1C;
  71.     CISTPL_DEVICE_OA            = $1D;
  72.     CISTPL_DEVICE_GEO            = $1E;
  73.     CISTPL_DEVICE_GEO_A            = $1F;
  74.     CISTPL_MANFID                = $20;
  75.     CISTPL_FUNCID                = $21;
  76.     CISTPL_FUNCE                = $22;
  77.     CISTPL_SWIL                    = $23;
  78.     CISTPL_VERS_2                = $40;
  79.     CISTPL_FORMAT                = $41;
  80.     CISTPL_GEOMETRY                = $42;
  81.     CISTPL_BYTEORDER            = $43;
  82.     CISTPL_DATE                    = $44;
  83.     CISTPL_BATTERY                = $45;
  84.     CISTPL_ORG                    = $46;
  85.     CISTPL_VENDOR                = $FE;
  86.     CISTPL_END                    = $FF;
  87.  
  88.  
  89. {————————————————————————————————————————————————————————————————————————
  90.     Tuple Data Block Definitions
  91. ————————————————————————————————————————————————————————————————————————}
  92.  
  93. { ------------    Device Information Tuple (01H, 17H)    -----------                             }
  94.  
  95.  
  96. TYPE
  97.     DeviceIDTuplePtr = ^DeviceIDTuple;
  98.     DeviceIDTuple = RECORD
  99.         TPLDEV_TYPE_WPS_SPEED:    SInt8;                                    {  Device Type Code: 7-4, WPS: 3,  Device Speed: 2-0 }
  100.         deviceData:                PACKED ARRAY [0..252] OF Byte;
  101.     END;
  102.  
  103.  
  104. CONST
  105.     TPLDEV_TYPE_MASK            = $F0;                            {  device type mask for TPLDEV_TYPE_WPS_SPEED }
  106.     TPLDEV_TYPE_EXTENDED        = $E0;                            {  device type value for extended type }
  107.     TPLDEV_WPS_MASK                = $08;                            {  write-protect switch mask for TPLDEV_TYPE_WPS_SPEED }
  108.     TPLDEV_SPEED_MASK            = $07;                            {  device speed mask for TPLDEV_TYPE_WPS_SPEED }
  109.     TPLDEV_DSPEED_NULL            = $00;                            {  speed for null device type }
  110.     TPLDEV_DSPEED_250NS            = $01;                            {  250ns card access time }
  111.     TPLDEV_DSPEED_200NS            = $02;                            {  200ns card access time }
  112.     TPLDEV_DSPEED_150NS            = $03;                            {  150ns card access time }
  113.     TPLDEV_DSPEED_100NS            = $04;                            {  100ns card access time }
  114.     TPLDEV_EXTENDED_SPEED        = $07;                            {  device speed value for extended speed }
  115.     TPLDEV_SPEED_EXPONENT        = $07;                            {  extended byte exponent mask }
  116.     TPLDEV_SPEED_MANTISSA        = $78;                            {  extended byte mantissa mask }
  117.     TPLDEV_SPEED_EXTENDED_MASK    = $80;                            {  bit set if more extended speed data follows }
  118.  
  119.  
  120. {     device ID types }
  121.  
  122.     DTYPE_NULL                    = 0;
  123.     DTYPE_ROM                    = 1;
  124.     DTYPE_OTPROM                = 2;
  125.     DTYPE_EPROM                    = 3;
  126.     DTYPE_EEPROM                = 4;
  127.     DTYPE_FLASH                    = 5;
  128.     DTYPE_SRAM                    = 6;
  129.     DTYPE_DRAM                    = 7;
  130.     DTYPE_FUNCSPEC                = $0D;
  131.     DTYPE_EXTEND                = $0E;
  132.  
  133.  
  134. { ---------------    Checksum Control Tuple (10H)    ---------------                             }
  135.  
  136.  
  137. TYPE
  138.     ChecksumControlTuplePtr = ^ChecksumControlTuple;
  139.     ChecksumControlTuple = RECORD
  140.         TPLCKS_ADDR:            INTEGER;                                {  offset to region to be checksummed, LSB first }
  141.         TPLCKS_LEN:                INTEGER;                                {  length of region to be checksummed, LSB first }
  142.         TPLCKS_CS:                SInt8;                                    {  checksum of the region }
  143.         reserved:                SInt8;                                    {  padding }
  144.     END;
  145.  
  146. { ----------------    Long Link Multi-Function Tuple (06H)    ------                     }
  147.  
  148.     LongLinkMFCTuplePtr = ^LongLinkMFCTuple;
  149.     LongLinkMFCTuple = PACKED RECORD
  150.         TPLMFC_NUM:                UInt8;                                    {  Number of sets of config registers for individual functions }
  151.         TPLMFC_TAS1:            UInt8;                                    {  CIS target address space for first function (00 = Attr, 01 = Common) }
  152.         TPLMFC_ADDR1:            UInt32;                                    {  Target address of first CIS, unsigned long, lsb first }
  153.         TPLMFC_TAS2:            UInt8;                                    {  CIS target address space for second function (00 = Attr, 01 = Common) }
  154.         TPLMFC_ADDR2:            PACKED ARRAY [0..3] OF UInt8;            {  [MISALIGNED!] Target address of second CIS, unsigned long, lsb first }
  155.                                                                         {  the following fields are of undetermined length and should be calculated at runtime }
  156.                                                                         {   }
  157.                                                                         {  UInt8        TPLMFC_TASn; }
  158.                                                                         {  UInt32        TPLMFC_ADDRn; }
  159.     END;
  160.  
  161. { ----------------    Long Link Tuple (11H, 12H)    ----------------                             }
  162.  
  163.     LongLinkTuplePtr = ^LongLinkTuple;
  164.     LongLinkTuple = RECORD
  165.         TPLL_ADDR:                UInt32;                                    {  target address, LSB first }
  166.     END;
  167.  
  168. { -----------------    Link Target Tuple (13H)    ------------------                             }
  169.  
  170.     LinkTargetTuplePtr = ^LinkTargetTuple;
  171.     LinkTargetTuple = RECORD
  172.         TPLL_TAG:                PACKED ARRAY [0..2] OF Byte;            {  tag: should be 'C', 'I', 'S' }
  173.     END;
  174.  
  175. { ----------------    Level 1 Version Tuple (15H)    ---------------                             }
  176.  
  177.     Level1VersionTuplePtr = ^Level1VersionTuple;
  178.     Level1VersionTuple = RECORD
  179.         TPLLV1_MAJOR:            SInt8;                                    {  major version number (0x04) }
  180.         TPLLV1_MINOR:            SInt8;                                    {  minor version number (0x01 for release 2.0 and 2.01) }
  181.         TPLLV1_INFO:            SInt8;                                    {  product information string, zero-terminated }
  182.     END;
  183.  
  184. { -------------    JEDEC Identifier Tuple (18H, 19H)    ------------                             }
  185.  
  186.     JEDECDeviceInfoPtr = ^JEDECDeviceInfo;
  187.     JEDECDeviceInfo = RECORD
  188.         manufacturerID:            SInt8;
  189.         manufacturerInfo:        SInt8;
  190.     END;
  191.  
  192.     JEDECIdentifierTuplePtr = ^JEDECIdentifierTuple;
  193.     JEDECIdentifierTuple = RECORD
  194.         device:                    ARRAY [0..0] OF JEDECDeviceInfo;
  195.     END;
  196.  
  197. { ---------    Configuration Tuple (1AH)    ----------                             }
  198.  
  199.     ConfigTuplePtr = ^ConfigTuple;
  200.     ConfigTuple = RECORD
  201.         TPCC_SZ:                SInt8;                                    {  size of fields byte }
  202.         TPCC_LAST:                SInt8;                                    {  index number of last config entry }
  203.         TPCC_RADR:                SInt8;                                    {  config reg's base addr in reg. space }
  204.         reserved:                SInt8;                                    {  padding }
  205.                                                                         {  the following fields are of undetermined length and should be calculated at runtime }
  206.                                                                         { UInt32            TPCC_RMSK; }
  207.                                                                         { UInt32            TPCC_RSVD; }
  208.                                                                         { UInt32            TPCC_SBTPL; }
  209.     END;
  210.  
  211. {     TPCC_RADR field definitions }
  212.  
  213. CONST
  214.     TPCC_RASZ                    = $03;                            {  bits 1-0 }
  215.     TPCC_RMSZ                    = $3C;                            {  bits 5-2 }
  216.     TPCC_RFSZ                    = $C0;                            {  bits 7-6 }
  217.  
  218.  
  219. { ---------    Device Geometry Tuple (1EH, 1FH)    ---------- }
  220.  
  221.  
  222. TYPE
  223.     DeviceGeometryPtr = ^DeviceGeometry;
  224.     DeviceGeometry = RECORD
  225.         DGTPL_BUS:                SInt8;                                    {  system bus width = 2^(n-1), n>0 }
  226.         DGTPL_EBS:                SInt8;                                    {  erase block size = 2^(n-1), n>0 }
  227.         DGTPL_RBS:                SInt8;                                    {  read block size = 2^(n-1), n>0 }
  228.         DGTPL_WBS:                SInt8;                                    {  write block size = 2^(n-1), n>0 }
  229.         DGTPL_PART:                SInt8;                                    {  partitioning size = 2^(n-1), n>0 }
  230.         DGTPL_HWIL:                SInt8;                                    {  hardware interleave = 2^(n-1), n>0 }
  231.     END;
  232.  
  233.     DeviceGeometryTuplePtr = ^DeviceGeometryTuple;
  234.     DeviceGeometryTuple = RECORD
  235.         device:                    ARRAY [0..41] OF DeviceGeometry;
  236.     END;
  237.  
  238. { ---------    Manufacturer Identification Tuple (20H)    ----------                             }
  239.  
  240.     ManufIDTuplePtr = ^ManufIDTuple;
  241.     ManufIDTuple = RECORD
  242.         TPLMID_MANF:            INTEGER;                                {  PCMCIA PC Card manufacturer code }
  243.         TPLMID_CARD:            INTEGER;                                {  manufacturer information (part number and/or revision) }
  244.     END;
  245.  
  246. { -----------    Function Identification Tuple (21H)    ------------                             }
  247.  
  248.     FunctionIDTuplePtr = ^FunctionIDTuple;
  249.     FunctionIDTuple = RECORD
  250.         TPLFID_FUNCTION:        SInt8;                                    {  PC card function code }
  251.         TPLFID_SYSINIT:            SInt8;                                    {  system initialization bit mask }
  252.     END;
  253.  
  254. {     function codes }
  255.  
  256. CONST
  257.     TPLFID_MultiFunction        = 0;
  258.     TPLFID_Memory                = 1;
  259.     TPLFID_SerialPort            = 2;
  260.     TPLFID_ParallelPort            = 3;
  261.     TPLFID_FixedDisk            = 4;
  262.     TPLFID_VideoAdapter            = 5;
  263.     TPLFID_NetworkLANAdapter    = 6;
  264.     TPLFID_AIMS                    = 7;
  265.     TPLFID_SCSI                    = 8;
  266.     TPLFID_Security                = 9;
  267.  
  268.  
  269. { ------------    Software Interleave Tuple (23H)    ---------------                             }
  270.  
  271.  
  272. TYPE
  273.     SoftwareInterleaveTuplePtr = ^SoftwareInterleaveTuple;
  274.     SoftwareInterleaveTuple = RECORD
  275.         TPLSWIL_INTRLV:            SInt8;                                    {  software interleave }
  276.     END;
  277.  
  278. { -------    Level 2 Version and Information Tuple (40H)    --------                             }
  279.  
  280.     Level2VersionTuplePtr = ^Level2VersionTuple;
  281.     Level2VersionTuple = RECORD
  282.         TPLLV2_VERS:            SInt8;                                    {  structure version (0x00) }
  283.         TPLLV2_COMPLY:            SInt8;                                    {  level of compliance with the standard (0x00) }
  284.         TPLLV2_DINDEX:            UInt16;                                    {  byte address of first data byte in card, LSB first }
  285.         TPLLV2_RSV6:            SInt8;                                    {  reserved, must be zero }
  286.         TPLLV2_RSV7:            SInt8;                                    {  reserved, must be zero }
  287.         TPLLV2_VSPEC8:            SInt8;                                    {  vendor specific byte }
  288.         TPLLV2_VSPEC9:            SInt8;                                    {  vendor specific byte }
  289.         TPLLV2_NHDR:            SInt8;                                    {  number of copies of CIS present on this device }
  290.         TPLLV2_OEM:                SInt8;                                    {  vendor of software that formatted card, zero-terminated }
  291.         TPLLV2_INFO:            SInt8;                                    {  informational message about the card, zero-terminated }
  292.         reserved:                SInt8;                                    {  padding }
  293.     END;
  294.  
  295. { --------------------    Format Tuple (41H)    --------------------                             }
  296.  
  297. {  additional information for disk type: }
  298.  
  299.     FormatDiskTuplePtr = ^FormatDiskTuple;
  300.     FormatDiskTuple = RECORD
  301.         TPLFMT_BKSZ:            UInt16;                                    {     block size, or zero if unblocked format }
  302.         TPLFMT_NBLOCKS:            UInt32;                                    {     number of data blocks in this partition }
  303.         TPLFMT_EDCLOC:            UInt32;                                    {     location of error detection code, or zero if interleaved }
  304.     END;
  305.  
  306. {  additional information for disk type: }
  307.     FormatMemTuplePtr = ^FormatMemTuple;
  308.     FormatMemTuple = RECORD
  309.         TPLFMT_FLAGS:            SInt8;                                    {     various flags }
  310.         TPLFMT_RESERVED:        SInt8;                                    {     reserved, set to zero }
  311.         TPLFMT_ADDRESS:            UInt32;                                    {     physical location at which this memory partion must be mapped }
  312.         TPLFMT_EDCLOC:            UInt32;                                    {     location of error detection code, or zero if interleaved }
  313.     END;
  314.  
  315.     FormatTuplePtr = ^FormatTuple;
  316.     FormatTuple = RECORD
  317.         TPLFMT_TYPE:            SInt8;                                    {  format type code }
  318.         TPLFMT_EDC:                SInt8;                                    {  error detection method and length of error detection code }
  319.         TPLFMT_OFFSET:            LONGINT;                                {  offset to first data byte in this partition }
  320.         TPLFMT_NBYTES:            LONGINT;                                {  number of data bytes in this partition }
  321.         CASE INTEGER OF
  322.         0: (
  323.             TPLFMT_DISK:        FormatDiskTuple;
  324.             );
  325.         1: (
  326.             TPLFMT_MEM:            FormatMemTuple;
  327.             );
  328.     END;
  329.  
  330. {     format types }
  331.  
  332. CONST
  333.     TPLFMTTYPE_DISK                = 0;
  334.     TPLFMTTYPE_MEM                = 1;
  335.     TPLFMTTYPE_VS                = $80;
  336.  
  337. {     error detection types }
  338.  
  339.     TPLFMTEDC_NONE                = 0;
  340.     TPLFMTEDC_CKSUM                = 1;
  341.     TPLFMTEDC_CRC                = 2;
  342.     TPLFMTEDC_PCC                = 3;
  343.     TPLFMTEDC_VS                = 8;
  344.  
  345. {     bits in TPLFMT_FLAGS }
  346.  
  347.     TPLFMTFLAGS_ADDR            = 0;
  348.     TPLFMTFLAGS_AUTO            = 1;
  349.  
  350.  
  351. { ------------------    Geometry Tuple (42H)    --------------------                             }
  352.  
  353.  
  354. TYPE
  355.     GeometryTuplePtr = ^GeometryTuple;
  356.     GeometryTuple = RECORD
  357.         TPLGEO_SPT:                SInt8;                                    {  number of sectors per track }
  358.         TPLGEO_TPC:                SInt8;                                    {  number of tracks per cylinder }
  359.         TPLGEO_NCYL:            INTEGER;                                {  number of cylinders, total }
  360.     END;
  361.  
  362. { -----------------    Byte-Order Tuple (43H)    -------------------                             }
  363.  
  364.     ByteOrderTuplePtr = ^ByteOrderTuple;
  365.     ByteOrderTuple = RECORD
  366.         TPLBYTE_ORDER:            SInt8;                                    {  byte order code }
  367.         TPLBYTE_MAP:            SInt8;                                    {  byte mapping code }
  368.     END;
  369.  
  370. {     byte order codes }
  371.  
  372. CONST
  373.     TYPBYTEORD_LOW                = 0;
  374.     TYPBYTEORD_HIGH                = 1;
  375.     TYPBYTEORD_VS                = $80;
  376.  
  377. {     byte mapping codes }
  378.  
  379.     TYPBYTEMAP_LOW                = 0;
  380.     TYPBYTEMAP_HIGH                = 1;
  381.     TYPBYTEMAP_VS                = $80;
  382.  
  383.  
  384. { ----------    Card Initialization Date Tuple (44H)    ------------                             }
  385.  
  386.  
  387. TYPE
  388.     CardInitDateTuplePtr = ^CardInitDateTuple;
  389.     CardInitDateTuple = RECORD
  390.         TPLDATE_TIME:            UInt16;                                    {  hours, minutes, seconds }
  391.         TPLDATE_DAY:            UInt16;                                    {  year, month, day }
  392.     END;
  393.  
  394. { ----------    Battery-Replacement Date Tuple (45H)    ------------                             }
  395.  
  396.     BatteryReplaceDateTuplePtr = ^BatteryReplaceDateTuple;
  397.     BatteryReplaceDateTuple = RECORD
  398.         TPLBATT_RDAY:            UInt16;                                    {  last replacement date (year, month, day) }
  399.         TPLBATT_XDAY:            UInt16;                                    {  battery expiration date (year, month, day) }
  400.     END;
  401.  
  402.  
  403. { ----------------------    General Tuple    -----------------------                             }
  404.  
  405.     TupleBodyPtr = ^TupleBody;
  406.     TupleBody = RECORD
  407.         CASE INTEGER OF
  408.         0: (
  409.             deviceID:            DeviceIDTuple;
  410.             );
  411.         1: (
  412.             checksum:            ChecksumControlTuple;
  413.             );
  414.         2: (
  415.             link:                LongLinkTuple;
  416.             );
  417.         3: (
  418.             target:                LinkTargetTuple;
  419.             );
  420.         4: (
  421.             level1:                Level1VersionTuple;
  422.             );
  423.         5: (
  424.             jedecID:            JEDECIdentifierTuple;
  425.             );
  426.         6: (
  427.             config:                ConfigTuple;
  428.             );
  429.         7: (
  430.             devGeo:                DeviceGeometryTuple;
  431.             );
  432.         8: (
  433.             manufID:            ManufIDTuple;
  434.             );
  435.         9: (
  436.             funcID:                FunctionIDTuple;
  437.             );
  438.         10: (
  439.             swil:                SoftwareInterleaveTuple;
  440.             );
  441.         11: (
  442.             level2:                Level2VersionTuple;
  443.             );
  444.         12: (
  445.             format:                FormatTuple;
  446.             );
  447.         13: (
  448.             geometry:            GeometryTuple;
  449.             );
  450.         14: (
  451.             order:                ByteOrderTuple;
  452.             );
  453.         15: (
  454.             initDate:            CardInitDateTuple;
  455.             );
  456.         16: (
  457.             battDate:            BatteryReplaceDateTuple;
  458.             );
  459.         17: (
  460.             tupleData:            PACKED ARRAY [0..253] OF Byte;
  461.             );
  462.     END;
  463.  
  464.     TuplePtr = ^Tuple;
  465.     Tuple = RECORD
  466.         TPL_CODE:                SInt8;
  467.         TPL_LINK:                SInt8;
  468.         TPL_BODY:                TupleBody;
  469.     END;
  470.  
  471. {$ALIGN RESET}
  472. {$POP}
  473.  
  474. {$SETC UsingIncludes := PCCardTuplesIncludes}
  475.  
  476. {$ENDC} {__PCCARDTUPLES__}
  477.  
  478. {$IFC NOT UsingIncludes}
  479.  END.
  480. {$ENDC}
  481.